package 数据结构练习;

public class 冒泡排序 {
    public static void main(String[] args) {
        int a[] = new int[]{5,9,6,7,3,1,2,4,8};
        int c;
        for(int j=0;j<a.length-1;j++){
            for (int k=j;k<a.length;k++){
                if(a[j]>a[k]){
                    c = a[j];
                    a[j] = a[k];
                    a[k] = c;
                }
            }
        }

        for(int x:a){
            System.out.print(x+" ");
        }
    }
}
